# 使用 Process 子类创建进程

from multiprocessing import Process


# 定义一个类，继承 Process
class SubProcess(Process):
    def __init__(self, *param, name):
        Process.__init__(self)
        self.param = param
        self.name = name

    def run(self):
        print("子进程", self.name, "内容：", self.param)


if __name__ == "__main__":
    # 创建两个进程
    p1 = SubProcess("苹果", "樱桃", name="thead-1")
    p2 = SubProcess("车厘子", "芒果", name="thead-2")
    p1.start()
    p2.start()
    p1.join()
    p2.join()
